package com.ljj.service.impl;

import com.github.pagehelper.PageInfo;
import com.ljj.pojo.Score;
import com.ljj.mapper.ScoreMapper;
import com.ljj.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author LJJ
 * @since 2020-07-11
 */
@Service
public class ScoreServiceImpl  implements ScoreService {


    @Autowired
    ScoreMapper scoreMapper;

    @Override
    public int addScore(Score score) {
        return scoreMapper.insert(score);
    }

    @Override
    public int deleteScore(Score score) {
        return scoreMapper.deleteScore(score);
    }

    @Override
    public int updateScore(Score score) {
        return scoreMapper.updateScore(score);
    }

    @Override
    public List<Score> queryScoreBysid(int sid) {
        return scoreMapper.queryScoreBysid(sid);
    }

    @Override
    public Score queryByScore(Score score) {
        return  scoreMapper.queryByScore(score);
    }

    @Override
    public PageInfo<Score> queryScoreBysidPage(int sid, Integer pageNum, Integer pageSize) {
        List<Score> scores = scoreMapper.queryScoreBysid(sid);

        PageInfo<Score> scorePageInfo = new PageInfo<>(scores);
        return  scorePageInfo;
    }

}
